import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { MallGoods } from '@/entities/MallGoods';
import { Repository, FindManyOptions, FindConditions } from 'typeorm';
import { PageQuery, PageResult } from '@/common/interfaces/Pagination';
import { BuildPagination } from '@/common/utils/page.heler';
import { MallGoodsAttribute } from '@/entities/MallGoodsAttribute';

@Injectable()
export class GoodsAttributeService {
  constructor(@InjectRepository(MallGoodsAttribute) private readonly repository: Repository<MallGoodsAttribute>) {}

  findByGoodsId(goodsId: number) {
    return this.repository.findOne({ goodsId });
  }

  findAll(params: FindConditions<MallGoodsAttribute>) {
    return this.repository.find(params);
  }
}
